/*
* Copyright (C) 2012-2014 qar
* License: http://www.gnu.org/licenses/gpl.html GPL version 2
*/

#ifndef ENCRYPTOR_H
#define ENCRYPTOR_H

#include <QtCore>

class Encryptor
{
public:
    Encryptor();
    virtual ~Encryptor();

    virtual qint64 blockSize() const = 0;
	virtual qint64 keySize() const = 0;

    virtual QString getAlgorithmName() const = 0;

    // The length of the data must be a multiple of the block size.
    virtual void encrypt(const QByteArray &clearText, QByteArray &cipherText) = 0;
    virtual void decrypt(const QByteArray &cipherText, QByteArray &clearText) = 0;

    // Serialization of parameters
    virtual bool toStream(QDataStream &s) = 0;
    virtual bool fromStream(QDataStream &s) = 0;

private:
    Q_DISABLE_COPY(Encryptor)
};

#endif // ENCRYPTOR_H
